package com.ruoyi.project.kkad.whiteip.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.kkad.whiteip.domain.WhiteIp;
import com.ruoyi.project.kkad.whiteip.mapper.WhiteIpMapper;
import com.ruoyi.project.kkad.whiteip.service.IWhiteIpService;

/**
 * 白名单IPService业务层处理
 * 
 * @author shixiangwen
 * @date 2020-04-13
 */
@Service
@DataSource(DataSourceType.KKAD)
public class WhiteIpServiceImpl implements IWhiteIpService {

	@Autowired
	private WhiteIpMapper whiteIpMapper;

	/**
	 * 查询白名单IP
	 * 
	 * @param id 白名单IPID
	 * @return 白名单IP
	 */
	@Override
	public WhiteIp selectWhiteIpById(Long id) {
		return whiteIpMapper.selectWhiteIpById(id);
	}

	/**
	 * 查询白名单IP列表
	 * 
	 * @param whiteIp 白名单IP
	 * @return 白名单IP
	 */
	@Override
	public List<WhiteIp> selectWhiteIpList(WhiteIp whiteIp) {
		return whiteIpMapper.selectWhiteIpList(whiteIp);
	}

	/**
	 * 新增白名单IP
	 * 
	 * @param whiteIp 白名单IP
	 * @return 结果
	 */
	@Override
	public int insertWhiteIp(WhiteIp whiteIp) {
		return whiteIpMapper.insertWhiteIp(whiteIp);
	}

	/**
	 * 修改白名单IP
	 * 
	 * @param whiteIp 白名单IP
	 * @return 结果
	 */
	@Override
	public int updateWhiteIp(WhiteIp whiteIp) {
		return whiteIpMapper.updateWhiteIp(whiteIp);
	}

	/**
	 * 删除白名单IP对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deleteWhiteIpByIds(String ids) {
		return whiteIpMapper.deleteWhiteIpByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除白名单IP信息
	 * 
	 * @param id 白名单IPID
	 * @return 结果
	 */
	@Override
	public int deleteWhiteIpById(Long id) {
		return whiteIpMapper.deleteWhiteIpById(id);
	}
}
